package com.xjrsoft.module.erpModel.caseErpPurchase.utils;

import cn.hutool.core.util.RandomUtil;
import com.xjrsoft.module.erpModel.caseErpPurchase.vo.PayLogVo;
import com.xjrsoft.module.erpModel.caseErpStock.vo.InStoreLogVo;
import com.xjrsoft.module.erpModel.caseErpStock.vo.TicketLogVo;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

public final class DataUtil {
    private DataUtil(){}

    // 构建采购订单入库记录
    public static List<InStoreLogVo> buildInStoreLogList(Long purchaseId) {
        List<InStoreLogVo> resultList = new ArrayList<>();
        InStoreLogVo inStoreLog1 = new InStoreLogVo();
        inStoreLog1.setId(1L);
        inStoreLog1.setPurchaseId(purchaseId);
        inStoreLog1.setCode("RK20230110" + RandomUtil.randomNumbers(3));
        inStoreLog1.setTheme("aaaa");
        inStoreLog1.setDate(LocalDateTime.now().plusDays(-3));
        inStoreLog1.setName("客户一");
        inStoreLog1.setCount(new BigDecimal(653));
        inStoreLog1.setPerson("赵四");
        inStoreLog1.setStore("仓库一");
        resultList.add(inStoreLog1);

        InStoreLogVo inStoreLog2 = new InStoreLogVo();
        inStoreLog2.setId(2L);
        inStoreLog2.setPurchaseId(purchaseId);
        inStoreLog2.setCode("RK20230112" + RandomUtil.randomNumbers(3));
        inStoreLog2.setTheme("bbbb");
        inStoreLog2.setDate(LocalDateTime.now().plusDays(-32));
        inStoreLog2.setName("客户二");
        inStoreLog2.setCount(new BigDecimal(66));
        inStoreLog2.setPerson("张六");
        inStoreLog2.setStore("仓库二");
        resultList.add(inStoreLog2);

        InStoreLogVo inStoreLog3 = new InStoreLogVo();
        inStoreLog3.setId(3L);
        inStoreLog3.setPurchaseId(purchaseId);
        inStoreLog3.setCode("RK20230111" + RandomUtil.randomNumbers(3));
        inStoreLog3.setTheme("cccc");
        inStoreLog3.setDate(LocalDateTime.now().plusDays(-4));
        inStoreLog3.setName("客户三");
        inStoreLog3.setCount(new BigDecimal(153));
        inStoreLog3.setPerson("赵四");
        inStoreLog3.setStore("仓库三");
        resultList.add(inStoreLog3);
        return resultList;
    }

    // 构建采购订单到票记录
    public static List<TicketLogVo> buildTicketLogList(Long purchaseId) {
        List<TicketLogVo> resultList = new ArrayList<>();
        TicketLogVo ticketLog1 = new TicketLogVo();
        ticketLog1.setId(1L);
        ticketLog1.setPurchaseId(purchaseId);
        ticketLog1.setCode("DP20221215" + RandomUtil.randomNumbers(3));
        ticketLog1.setTheme("aaaa");
        ticketLog1.setDate(LocalDateTime.now().plusDays(-8));
        ticketLog1.setName("供应商一");
        ticketLog1.setTicketNum(RandomUtil.randomNumbers(10));
        ticketLog1.setTicketAmount(new BigDecimal(125.00));
        resultList.add(ticketLog1);

        TicketLogVo ticketLog2 = new TicketLogVo();
        ticketLog2.setId(2L);
        ticketLog2.setPurchaseId(purchaseId);
        ticketLog2.setCode("DP20221228" + RandomUtil.randomNumbers(3));
        ticketLog2.setTheme("bbbb");
        ticketLog2.setDate(LocalDateTime.now().plusDays(-21));
        ticketLog2.setName("供应商二");
        ticketLog2.setTicketNum(RandomUtil.randomNumbers(10));
        ticketLog2.setTicketAmount(new BigDecimal(632.00));
        resultList.add(ticketLog2);

        TicketLogVo ticketLog3 = new TicketLogVo();
        ticketLog3.setId(3L);
        ticketLog3.setPurchaseId(purchaseId);
        ticketLog3.setCode("DP20230106" + RandomUtil.randomNumbers(3));
        ticketLog3.setTheme("cccc");
        ticketLog3.setDate(LocalDateTime.now().plusDays(-1));
        ticketLog3.setName("供应商三");
        ticketLog3.setTicketAmount(new BigDecimal(2000.00));
        ticketLog3.setTicketNum(RandomUtil.randomNumbers(10));
        resultList.add(ticketLog3);
        return resultList;
    }

    // 构建采购订单付款记录
    public static List<PayLogVo> buildPayLogList(Long purchaseId) {
        List<PayLogVo> resultList = new ArrayList<>();
        PayLogVo payLog1 = new PayLogVo();
        payLog1.setId(1L);
        payLog1.setPurchaseId(purchaseId);
        payLog1.setCode("FK20221110" + RandomUtil.randomNumbers(3));
        payLog1.setTheme("aaaa");
        payLog1.setDate(LocalDateTime.now().plusDays(-15));
        payLog1.setAmount(new BigDecimal(166.00));
        payLog1.setPayer("供应商一");
        payLog1.setAccount(RandomUtil.randomNumbers(10));
        resultList.add(payLog1);

        PayLogVo payLog2 = new PayLogVo();
        payLog2.setId(2L);
        payLog2.setPurchaseId(purchaseId);
        payLog2.setCode("FK20230108" + RandomUtil.randomNumbers(3));
        payLog2.setTheme("bbbb");
        payLog2.setDate(LocalDateTime.now().plusDays(-3));
        payLog2.setAmount(new BigDecimal(153.10));
        payLog2.setAccount(RandomUtil.randomNumbers(10));
        payLog2.setPayer("供应商二");
        resultList.add(payLog2);

        PayLogVo payLog3 = new PayLogVo();
        payLog3.setId(3L);
        payLog3.setPurchaseId(purchaseId);
        payLog3.setCode("FK20230112" + RandomUtil.randomNumbers(3));
        payLog3.setTheme("cccc");
        payLog3.setDate(LocalDateTime.now().plusDays(-36));
        payLog3.setPayer("供应商三");
        payLog3.setAmount(new BigDecimal(2300.00));
        payLog3.setAccount(RandomUtil.randomNumbers(10));
        resultList.add(payLog3);
        return resultList;
    }
}
